
package org.ring.server;

import com.ring.client.ClientCoreSDK;
import com.ring.client.conf.ConfigEntity;
import com.ring.client.core.LocalDataSender;
import com.ring.server.protocal.PLoginInfo;

/**
 * @since 2023-10-23 09:30
 */
public class ClientStarter {

    public static void main(String[] args)  throws Exception{
        ClientCoreSDK clientCoreSDK = ClientCoreSDK.getInstance();
        clientCoreSDK.init();

        // 设置服务器地址和端口号
        ConfigEntity.serverIP = "127.0.0.1";

        LocalDataSender localDataSender = LocalDataSender.getInstance();
        PLoginInfo pLoginInfo = new PLoginInfo("u001","t");
        int resultCode = localDataSender.sendLogin(pLoginInfo);
        if(resultCode != 0){
            System.out.println("login failure result code = " + resultCode);
        }
        clientCoreSDK.setCurrentLoginInfo(pLoginInfo);
        String hi = "hi my friend";
        String fid = "x002";


        while (true){
            Thread.sleep(5000L);
            resultCode =  localDataSender.sendCommonData(hi, fid);
            System.out.println(resultCode );
        }
    }
}
